<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <head>
    <title>Custom Fields</title>
  </head>

  <body>
    <div id="content" class="customfields">
      <h1>Custom Fields</h1>

      <py:choose test="customfields.count() == 0">

      <py:when test="True">
      <div id="description">
        <p>No custom field found.</p>
      </div>
      </py:when>

      <py:otherwise>
      <py:def function="show_checkbox(value)">
      <input type="checkbox" checked="${value and 'checked' or None}" disabled="disabled" />
      </py:def>
      <table class="listing customfields">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Label</th>
            <th>Type</th>
            <th>Project</th>
            <th>TestSuite</th>
            <th>TestCase</th>
          </tr>
        </thead>
        <tbody>
          <py:for each="idx, customfield in enumerate(customfields)">
            <tr class="${idx % 2 and 'odd' or 'even'}">
              <td><a href="${href.test('customfield', customfield.id)}">$customfield.id</a></td>
              <td class="name">$customfield.name</td>
              <td class="label">$customfield.label</td>
              <td class="type">${get_field_type_name(customfield.field_type)}</td>
              <td align="center">${show_checkbox(customfield.enable_on_project)}</td>
              <td align="center">${show_checkbox(customfield.enable_on_testsuite)}</td>
              <td align="center">${show_checkbox(customfield.enable_on_testcase)}</td>
            </tr>
          </py:for>
        </tbody>
      </table>
      </py:otherwise>

      </py:choose>

      <div py:if="'TEST_EDIT' in perm" class="buttons">
        <form method="GET" action="${href.test(project_id, 'newcustomfield')}">
          <div>
            <input type="submit" value="Create new field" />
          </div>
        </form>
      </div>

      <div id="help"><strong>Note:</strong> 
        See <a href="${href.wiki(TracTestManagement)}">TracTestManagement</a> for help on using and creating custom field.
      </div> 

    </div>
  </body>
</html>

